home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-03-24 | 12.0 KB | 429 lines | [TEXT/MPS ] |
- { ------------------------------------------------------------------------------
-
- FILENAME
- Collections.p
-
- DESCRIPTION
- This file contains all of the public data structures, constants, and
- function declarations for the Collection Manager.
-
- COPYRIGHT
- Copyright © Apple Computer, Inc. 1989, 1990, 1991, 1992, 1993
- All rights reserved.
-
- ------------------------------------------------------------------------------- }
-
-
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT Collections;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED UsingCollections}
- {$SETC UsingCollections := 1}
-
- {$I+}
- {$SETC CollectionsIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
- {$IFC UNDEFINED UsingTypes}
- {$I $$Shell(PInterfaces)Types.p}
- {$ENDC}
- {$SETC UsingIncludes := CollectionsIncludes}
-
- { Constants }
-
-
- CONST
- { Collection Manager Gestalt Selector... }
-
- gestaltCollectionMgrVersion = 'cltn';
-
- { Collection Manager Error Result Codes... }
-
- collectionItemLockedErr = -5750;
- collectionItemNotFoundErr = -5751;
- collectionIndexRangeErr = -5752;
- collectionVersionErr = -5753;
-
-
- { Convenience constants for calls to functions which optionally return values... }
-
- dontWantTag = 0;
- dontWantId = 0;
- dontWantSize = 0;
- dontWantAttributes = 0;
- dontWantIndex = 0;
- dontWantData = 0;
-
-
- { attributes bits }
-
- noCollectionAttributes = $00000000; { no attributes bits set }
- allCollectionAttributes = $FFFFFFFF; { all attributes bits set }
- userCollectionAttributes = $0000FFFF; { user attributes bits }
- defaultCollectionAttributes = $40000000; { default attributes - unlocked, persistent }
-
-
- {
- Attribute bits 0 through 15 (entire low word) are reserved for use by the application.
- Attribute bits 16 through 31 (entire high word) are reserved for use by the Collection Manager.
- Only bits 31 (collectionLockBit) and 30 (collectionPersistenceBit) currently have meaning.
- }
-
-
- collectionUser0Bit = 0;
- collectionUser1Bit = 1;
- collectionUser2Bit = 2;
- collectionUser3Bit = 3;
- collectionUser4Bit = 4;
- collectionUser5Bit = 5;
- collectionUser6Bit = 6;
- collectionUser7Bit = 7;
- collectionUser8Bit = 8;
- collectionUser9Bit = 9;
- collectionUser10Bit = 10;
- collectionUser11Bit = 11;
- collectionUser12Bit = 12;
- collectionUser13Bit = 13;
- collectionUser14Bit = 14;
- collectionUser15Bit = 15;
-
- collectionReserved0Bit = 16;
- collectionReserved1Bit = 17;
- collectionReserved2Bit = 18;
- collectionReserved3Bit = 19;
- collectionReserved4Bit = 20;
- collectionReserved5Bit = 21;
- collectionReserved6Bit = 22;
- collectionReserved7Bit = 23;
- collectionReserved8Bit = 24;
- collectionReserved9Bit = 25;
- collectionReserved10Bit = 26;
- collectionReserved11Bit = 27;
- collectionReserved12Bit = 28;
- collectionReserved13Bit = 29;
-
- collectionPersistenceBit = 30;
- collectionLockBit = 31;
-
-
- { attribute masks }
-
- collectionUser0Mask = $00000001;
- collectionUser1Mask = $00000002;
- collectionUser2Mask = $00000004;
- collectionUser3Mask = $00000008;
- collectionUser4Mask = $00000010;
- collectionUser5Mask = $00000020;
- collectionUser6Mask = $00000040;
- collectionUser7Mask = $00000080;
- collectionUser8Mask = $00000100;
- collectionUser9Mask = $00000200;
- collectionUser10Mask = $00000400;
- collectionUser11Mask = $00000800;
- collectionUser12Mask = $00001000;
- collectionUser13Mask = $00002000;
- collectionUser14Mask = $00004000;
- collectionUser15Mask = $00008000;
-
- collectionReserved0Mask = $00010000;
- collectionReserved1Mask = $00020000;
- collectionReserved2Mask = $00040000;
- collectionReserved3Mask = $00080000;
- collectionReserved4Mask = $00100000;
- collectionReserved5Mask = $00200000;
- collectionReserved6Mask = $00400000;
- collectionReserved7Mask = $00800000;
- collectionReserved8Mask = $01000000;
- collectionReserved9Mask = $02000000;
- collectionReserved10Mask = $04000000;
- collectionReserved11Mask = $08000000;
- collectionReserved12Mask = $10000000;
- collectionReserved13Mask = $20000000;
- collectionReserved14Mask = $40000000;
- collectionReserved15Mask = $80000000;
-
- collectionPersistenceMask = $40000000; { mask for lock bit }
- collectionLockMask = $80000000; { mask for lock bit }
-
-
- { the Collection Manager trap }
-
- collectionManagerTrap = $ABF6;
-
-
- { Types }
-
-
- TYPE
-
- PrivateCollectionRecord = LONGINT;
- Collection = ^PrivateCollectionRecord; { abstract data type for a collection }
- CollectionTag = LONGINT; { collection member 4 byte tag }
- CollectionTagPtr = ^CollectionTag;
- CollectionFlattenProc = ProcPtr;
- CollectionExceptionProc = ProcPtr;
-
-
- {
- A CollectionFlattenProc should look like this:
-
- FUNCTION MyFlattenProc (size : LONGINT; data : UNIV Ptr; refCon : UNIV Ptr) : OSErr;
- }
-
-
- {
- A CollectionExceptionProc should look like this:
-
- FUNCTION MyExceptionProc (aCollection : Collection; anErr : OSErr) : OSErr;
- }
-
-
- {*********************************************************************}
- { *************** Public Interfaces **********************}
- { ********************************************************************}
-
-
- FUNCTION NewCollection : Collection;
- INLINE $7000,collectionManagerTrap;
-
- PROCEDURE DisposeCollection (aCollection : Collection);
- INLINE $7001,collectionManagerTrap;
-
- FUNCTION CloneCollection (aCollection : Collection) : Collection;
- INLINE $7002,collectionManagerTrap;
-
- FUNCTION CountCollectionOwners (aCollection : Collection) : LONGINT;
- INLINE $7003,collectionManagerTrap;
-
- FUNCTION CopyCollection (srcCollection, dstCollection : Collection) : Collection;
- INLINE $7004,collectionManagerTrap;
-
- FUNCTION GetCollectionDefaultAttributes (aCollection : Collection) : LONGINT;
- INLINE $7005,collectionManagerTrap;
-
- PROCEDURE SetCollectionDefaultAttributes (aCollection : Collection;
- whichAttributes: LONGINT;
- newAttributes : LONGINT);
- INLINE $7006,collectionManagerTrap;
-
-
- FUNCTION CountCollectionItems (aCollection : Collection) : LONGINT;
- INLINE $7007,collectionManagerTrap;
-
-
- FUNCTION AddCollectionItem (aCollection : Collection;
- tag : CollectionTag;
- id : LONGINT;
- itemSize : LONGINT;
- pItemData : UNIV Ptr) : OSErr;
- INLINE $7008,collectionManagerTrap;
-
-
- FUNCTION GetCollectionItem (aCollection : Collection;
- tag : CollectionTag;
- id : LONGINT;
- pItemSize : LongIntPtr;
- pItemData : UNIV Ptr) : OSErr;
- INLINE $7009,collectionManagerTrap;
-
-
- FUNCTION RemoveCollectionItem (aCollection : Collection;
- tag : CollectionTag;
- id: LONGINT) : OSErr;
- INLINE $700A,collectionManagerTrap;
-
-
- FUNCTION SetCollectionItemInfo (aCollection : Collection;
- tag : CollectionTag;
- id : LONGINT;
- whichAttributes : LONGINT;
- newAttributes : LONGINT) : OSErr;
- INLINE $700B,collectionManagerTrap;
-
-
- FUNCTION GetCollectionItemInfo (aCollection : Collection;
- tag : CollectionTag;
- id : LONGINT;
- pIndex : LongIntPtr;
- pItemSize : LongIntPtr;
- pAttributes : LongIntPtr) : OSErr;
- INLINE $700C,collectionManagerTrap;
-
-
- FUNCTION ReplaceIndexedCollectionItem (aCollection : Collection;
- index : LONGINT;
- itemSize : LONGINT;
- pItemData : UNIV Ptr) : OSErr;
- INLINE $700D,collectionManagerTrap;
-
-
- FUNCTION GetIndexedCollectionItem (aCollection : Collection;
- index : LONGINT;
- pItemSize : LongIntPtr;
- pItemData : UNIV Ptr) : OSErr;
- INLINE $700E,collectionManagerTrap;
-
-
-
- FUNCTION RemoveIndexedCollectionItem (aCollection : Collection;
- index : LONGINT) : OSErr;
- INLINE $700F,collectionManagerTrap;
-
-
- FUNCTION SetIndexedCollectionItemInfo (aCollection : Collection;
- index : LONGINT;
- whichAttributes : LONGINT;
- newAttributes : LONGINT) : OSErr;
- INLINE $7010,collectionManagerTrap;
-
-
- FUNCTION GetIndexedCollectionItemInfo (aCollection : Collection;
- index : LONGINT;
- pTag : CollectionTagPtr;
- pId : LongIntPtr;
- pItemSize : LongIntPtr;
- pAttributes : LongIntPtr) : OSErr;
- INLINE $7011,collectionManagerTrap;
-
-
- FUNCTION CollectionTagExists (aCollection : Collection;
- tag : CollectionTag) : Boolean;
- INLINE $7012,collectionManagerTrap;
-
-
- FUNCTION CountCollectionTags (aCollection : Collection) : LONGINT;
- INLINE $7013,collectionManagerTrap;
-
-
- FUNCTION GetIndexedCollectionTag (aCollection : Collection;
- whichTag : LONGINT;
- var tag : CollectionTag) : OSErr;
- INLINE $7014,collectionManagerTrap;
-
-
- FUNCTION CountTaggedCollectionItems (aCollection : Collection;
- tag : CollectionTag) : LONGINT;
- INLINE $7015,collectionManagerTrap;
-
-
- FUNCTION GetTaggedCollectionItem (aCollection : Collection;
- tag : CollectionTag;
- whichItem : LONGINT;
- pItemSize : LongIntPtr;
- pItemData : UNIV Ptr) : OSErr;
- INLINE $7016,collectionManagerTrap;
-
-
- FUNCTION GetTaggedCollectionItemInfo (aCollection : Collection;
- tag : CollectionTag;
- whichItem : LONGINT;
- pID : LongIntPtr;
- pIndex : LongIntPtr;
- pItemSize : LongIntPtr;
- pAttributes : LongIntPtr) : OSErr;
- INLINE $7017,collectionManagerTrap;
-
-
- PROCEDURE PurgeCollection (aCollection : Collection;
- whichAttributes : LONGINT;
- matchingAttributes : LONGINT);
- INLINE $7018,collectionManagerTrap;
-
-
- PROCEDURE PurgeCollectionTag (aCollection : Collection;
- tag : CollectionTag);
- INLINE $7019,collectionManagerTrap;
-
-
- PROCEDURE EmptyCollection (aCollection : Collection);
- INLINE $701A,collectionManagerTrap;
-
-
- FUNCTION FlattenCollection (aCollection : Collection;
- flattenProc : CollectionFlattenProc;
- refCon : UNIV Ptr) : OSErr;
- INLINE $701B,collectionManagerTrap;
-
-
- FUNCTION FlattenPartialCollection (aCollection : Collection;
- flattenProc : CollectionFlattenProc;
- refCon : UNIV Ptr;
- whichAttributes : LONGINT;
- matchingAttributes : LONGINT) : OSErr;
- INLINE $701C,collectionManagerTrap;
-
-
- FUNCTION UnflattenCollection (aCollection : Collection;
- flattenProc: CollectionFlattenProc;
- refCon : UNIV Ptr) : OSErr;
- INLINE $701D,collectionManagerTrap;
-
-
- FUNCTION GetCollectionExceptionProc (aCollection : Collection) : CollectionExceptionProc;
- INLINE $701E,collectionManagerTrap;
-
-
- PROCEDURE SetCollectionExceptionProc (aCollection : Collection;
- exceptionProc : CollectionExceptionProc);
- INLINE $701F,collectionManagerTrap;
-
-
-
- {**************************************************************************************}
- { Utility Routines for handle-based access... }
- {**************************************************************************************}
-
-
-
- FUNCTION GetNewCollection (collectionID : INTEGER) : Collection;
- INLINE $7020,collectionManagerTrap;
-
-
- FUNCTION AddCollectionItemHdl (aCollection : Collection;
- tag : CollectionTag;
- id : LONGINT;
- hItemData : Handle) : OSErr;
- INLINE $7021,collectionManagerTrap;
-
-
- FUNCTION GetCollectionItemHdl (aCollection : Collection;
- tag : CollectionTag;
- id : LONGINT;
- hItemData : Handle) : OSErr;
- INLINE $7022,collectionManagerTrap;
-
-
- FUNCTION ReplaceIndexedCollectionItemHdl (aCollection : Collection;
- index : LONGINT;
- hItemData : Handle) : OSErr;
- INLINE $7023,collectionManagerTrap;
-
-
- FUNCTION GetIndexedCollectionItemHdl (aCollection : Collection;
- index : LONGINT;
- hItemData : Handle) : OSErr;
- INLINE $7024,collectionManagerTrap;
-
-
- FUNCTION FlattenCollectionToHdl (aCollection : Collection;
- flattened : Handle) : OSErr;
- INLINE $7025,collectionManagerTrap;
-
-
- FUNCTION UnflattenCollectionFromHdl (aCollection : Collection;
- flattened : Handle) : OSErr;
- INLINE $7026,collectionManagerTrap;
-
-
-
- {$ENDC} { UsingCollections }
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-